package cn.lzy.demo;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Description  xml 配置实现抽取公共属性
 * @Author lzy
 * @Date 2023/12/4 9:58
 * @Version
 **/
public class TestDemoXml {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        // Dog 没有继承 Animal，而是采用了抽取Bean的公共属性
        Dog dog1 = ctx.getBean("dog1", Dog.class);
        Dog dog2 = ctx.getBean("dog2", Dog.class);
        System.out.println("dog1 = " + dog1);
        System.out.println("dog2 = " + dog2);

        // Dog 没有继承 Animal，而是采用了抽取Bean的公共属性
        Cat cat = ctx.getBean(Cat.class);
        System.out.println("cat = " + cat);
    }
}
